package com.duoketech.model.room;
import com.duoketech.model.AbstractModel;
import com.duoketech.model.unit.Unit;
import com.duoketech.utils.PageUtil;

import java.util.List;

public class UnitRoom extends AbstractModel<UnitRoom>{
    public static final UnitRoom dao = new UnitRoom();

    public static final String ID = "id";//
    public static final String NAME = "name";//房间名称
    public static final String DESC = "desc";//房间简介
    public static final String PRICE = "price";//房价
    public static final String CREATE_BY = "create_by";//创建者
    public static final String CREATE_TIME = "create_time";//创建时间
    public static final String STATUS = "status";//房间状态
    public static final String MODIFY_TIME = "modify_time";//修改时间
    public static final String EQUIP = "equip";//配套设施
    public static final String CONTENT = "content";//客栈详细内容信息
    public static final String IMGS = "imgs";//客栈详细内容信息
    public static final String UNIT_ID = "unit_id";//客栈详细内容信息
    @Override
    public String tableName() {
        return "t_unit_room";
    }

    @Override
    public String status() {
        return statusConvert(getInt(STATUS));
    }


    public String statusConvert(int code){
        String result="未知";
        if(code==STATUS_NORMAL){
            result="正常预订";
        }
        return result;
    }

    public String price(){
        return PageUtil.fengToYuan(getInt(PRICE))+"";
    }


    public List<String> imgs(){
        return PageUtil.imgs(getStr(IMGS));
    }

    public Unit unitId(){
        return Unit.dao.findById(getInt(UNIT_ID));
    }
}